package hs.bank.Data;


import hs.bank.Entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface UserMapper {

    @Select("select userId, username, password from user where userId = #{userId}")
    User findById(@Param("userId") int userId);

    @Select("select userId, username, password from user where username = #{username}")
    User findByUsername(@Param("username") String username);

    @Insert("insert into user(userId, username, password) value(#{userId}, #{username}, #{password})")
    void save(User user);

    @Select("select count(userId) from user")
    int getCount();

    @Select("select max(userId) from user")
    int maxUserId();
}
